<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui"%>
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>还款明细</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
	<div class="Wrapper">
		<div id="pageInTab" class="pageInTab">
			<form id="scm_bsc_info_form">
				<div class="fieldset1 tabel_col tabel_col_s clearFix">
					<div class="caption">
						<span class="title">项目基础信息</span>
					</div>
					<div class="fieldBox col_50">
						<div class="label">项目名称</div>
						<div class="field">
							<span name="FNCPRJNM" id="FNCPRJNM" >${bscinfo.FNCPRJNM}</span>
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">项目编号</div>
						<div class="field">
							<span name="FNCPRJID" id="FNCPRJID" >${bscinfo.FNCPRJID}</span>
							<input type="hidden" id="payschid" name="payschid" value="${payschid}">
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">创建日期</div>
						<div class="field">
							<span name="CRTTM" id="CRTTM" >
								<fmt:parseDate value="${bscinfo.CRTTM}" var="date"/>
								<fmt:formatDate value="${date}" pattern="yyyy-MM-dd" />
							</span>
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">融资机构</div>
						<div class="field">
							<span name="FUNDRASINSNM" id="FUNDRASINSNM" >${bscinfo.FUNDRASINSNM}</span>
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">融资方案</div>
						<div class="field">
							<span name="FNCSCMNM" id="FNCSCMNM" >${bscinfo.FNCSCMNM}</span>
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">项目金额</div>
						<div class="field">
							<span name="FNCPRJAMT" id="FNCPRJAMT" >${bscinfo.FNCPRJAMT}</span>
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">融资金额</div>
						<div class="field">
							<span name="FNCFIAMT" id="FNCFIAMT" >${bscinfo.FNCFIAMT}</span>
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">支付表数量</div>
						<div class="field">
							<span name="PAYCNT" id="PAYCNT" >${bscinfo.PAYCNT}</span>
						</div>
					</div>
				</div>
				<div class="fieldset1 tabel_col tabel_col_s clearFix">
					<div class="caption">
						<span class="title">还款明细</span>
					</div>
					<div class="fieldBox col_100">
						<div id="cost1" class="sq-grid">
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>

<script type="text/javascript">
	var griddata1;
	$(function () {
		initDetlGrid();
	});
	
    function initDetlGrid() {
    	var schid = $("#payschid").val();
    	griddata1 = $("#cost1").ligerGrid({
	    	url: '<%=path%>/interest/management/initDetlGrid.do?payschid='+schid,
	    	method : 'get',
            columns: [
            { display: '期数', name: 'payPd', width: 50, type: 'int' },
            { display: '应还款项', name: 'feeClsCd',width: 150, type: 'text',
                render: function (item)
                {
                    if (parseInt(item.feeClsCd) == 1) return '本金';
                    return '利息';
                }},
            { display: '还款日', width: 150, name: 'gthrDt',render:renderDate},
            { display: '应还金额', name: 'feeAmt', width: 160, type: 'int'},
            { display: '已还金额', name: 'paidUpAmt', width: 160, type: 'int'},
            { display: '剩余金额', name: 'arAmt', width: 160, type: 'int'},
            { display: '本次还款额', name: 'actualAmt',type: 'int', width: 100},
            { display: '逻辑序号', name: 'id',width:0, align:'left', hide:true}
            ],
    		usePager: false
        });
    }

	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		}
		return dateStr;
	}
	
	//格式化金额
	function renderMoney(rowdata, index, value){
		var dateStr = 0;
		if(null != value){
			dateStr = value / 100;
		}
		return dateStr;
	}
	
	//格式化金额
	function formatMoney(){
		if($("#FNCPRJAMT").html() != ""){
			var fncPrjAmt = $("#FNCPRJAMT").html().toFixed(2);
			if(fncPrjAmt.substr(fncPrjAmt.indexOf(".")+1,fncPrjAmt.indexOf(".")+3) == "00"){
				$("#FNCPRJAMT").html(fncPrjAmt.substr(0,fncPrjAmt.indexOf(".")));
			}else{
				$("#FNCPRJAMT").html(fncPrjAmt);
			}
		}
		if($("#FNCFIAMT").html() != ""){
			var fncFiAmt = $("#FNCFIAMT").html().toFixed(2);
			if(fncFiAmt.substr(fncFiAmt.indexOf(".")+1,fncFiAmt.indexOf(".")+3) == "00"){
				$("#FNCFIAMT").html(fncFiAmt.substr(0,fncFiAmt.indexOf(".")));
			}else{
				$("#FNCFIAMT").html(fncFiAmt);
			}
		}
		
	}
	
</script>
</body>
</html>